import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    isLogin: 0,
    pageNum: 1,
    userInfo: ""
  },
  mutations: {
    changeLogin(state, status) {
      state.isLogin = status;
    },
    setPageNum(state, num) {
      state.pageNum = num;
    },
    commitUserInfo(state, info) {
      state.userInfo = info;
    }
  },
  actions: {
    loginAction({ commit }, num) {
      commit("changeLogin", num);
    },
    userInfoAction({ commit }, info) {
      commit("commitUserInfo", info);
    }
  }
});
